#!/bin/bash
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This is for bash on NaCl. Note that you cannot use external commands
# until the installation is completed. Also, you cannot use features
# which nacl_io does not support yet (e.g., pipes and sub-shells).

# Setup environment once to get location of fixed things like coreutils.
source /mnt/http/setup-environment

/mnt/http/install-base-packages.sh

# Setup environment again, to rescan the packages added.
source /mnt/http/setup-environment

# TODO(bradnelson): Drop this when we can install things in a more
# normal location and when we include the git templates in the normal
# location.
# Disabling templatedir as our git package lacks a default template set.
# Setting up a default git identity, since we lack /etc/passwd as
# a fallback.
# Setup default .gitconfig if it doesn't already exist.
if [[ ! -e /home/user/.gitconfig ]]; then
  git config --global init.templatedir ""
  git config --global user.name "John Doe"
  git config --global user.email "john.doe@foo.com"
fi

cd ${HOME}

if [ -e ${HOME}/.bashrc ]; then
  source ${HOME}/.bashrc
fi
